package domain;


import java.util.ArrayList;
import java.util.List;

public class Node 
{
    private int depthFromHere = 0; // specifies how deep this branch may go
    private Board board;
	private Node parent;
    private Integer value = 0;
    private Move lastMove;
    private List<Node> children = new ArrayList<Node>();
    
//    public Node(Node parent)
//    {
//    	this.parent = parent;
//    }
    
    public Node(Board board, Node parent, Move move)
    {
    	this.board = board;
    	this.parent = parent;
    	this.lastMove = move;
    }
    
    public int getDepthFromHere()
    {
    	return depthFromHere;
    }
    
    public void increaseDepth()
    {
    	depthFromHere++;
    	if (parent != null)
    		parent.increaseDepth();
    }
    
    public Move getLastMove()
    {
    	return lastMove;
    }
    
    public Board getBoard()
    {
    	return board;
    }
    
	public Node getParent() 
	{
		return parent;
	}

	public Integer getValue() 
	{
		return value;
	}
	
	public List<Node> getChildren() 
	{
		return children;
	}

    public void setValue(Integer value) 
    {
    	this.value = value;
    }
    
    public void addChild(Node childNode) 
    {
    	children.add(childNode);
    }
    
    public boolean hasEqualValue(Node other)
    {
    	return value.intValue() == other.value.intValue();
    }
}